<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="ArticulosEditDlg" widgetVar="ArticulosEditDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.EditArticulosTitle}">

            <h:form id="ArticulosEditForm">

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" rendered="#{articulosController.selected != null}">

                        <h:outputLabel value="#{bundle.EditArticulosLabel_codArticulo}" for="codArticulo" />
                        <h:outputText id="codArticulo" value="#{articulosController.selected.codArticulo}" />

                        <p:outputLabel value="#{bundle.EditArticulosLabel_descripcion}" for="descripcion" />
                        <p:inputText id="descripcion" value="#{articulosController.selected.descripcion}" title="#{bundle.EditArticulosTitle_descripcion}" required="true" requiredMessage="#{bundle.EditArticulosRequiredMessage_descripcion}"/>

                        <p:outputLabel value="#{bundle.EditArticulosLabel_nroParte}" for="nroParte" />
                        <p:inputText id="nroParte" value="#{articulosController.selected.nroParte}" title="#{bundle.EditArticulosTitle_nroParte}" />

                        <p:outputLabel value="#{bundle.EditArticulosLabel_precio}" for="precio" />
                        <p:inputText id="precio" value="#{articulosController.selected.precio}" title="#{bundle.EditArticulosTitle_precio}" />

                        <p:outputLabel value="#{bundle.EditArticulosLabel_codOrigen}" for="codOrigen" />
                        <p:inputText id="codOrigen" value="#{articulosController.selected.codOrigen}" title="#{bundle.EditArticulosTitle_codOrigen}" />

                        <p:outputLabel value="#{bundle.EditArticulosLabel_codMarca}" for="codMarca" />
                        <p:selectOneMenu id="codMarca" value="#{articulosController.selected.codMarca}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{marcasController.items}"
                                           var="codMarcaItem"
                                           itemValue="#{codMarcaItem}"
                                           itemLabel="#{codMarcaItem.descripcion.toString()}"
                                           />
                            <f:converter binding="#{marcasConverter}"/>
                        </p:selectOneMenu>

                        <p:outputLabel value="#{bundle.EditArticulosLabel_codFamilia}" for="codFamilia" />
                        <p:selectOneMenu id="codFamilia" value="#{articulosController.selected.codFamilia}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{familiaArticulosController.items}"
                                           var="codFamiliaItem"
                                           itemValue="#{codFamiliaItem}"
                                           itemLabel="#{codFamiliaItem.descripcion.toString()}"
                                           />
                            <f:converter binding="#{familiaArticulosConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{articulosController.save}" value="#{bundle.Save}" update="display,:ArticulosListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,ArticulosEditDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="ArticulosEditDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
